package com.gxuwz.easyschool.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import com.gxuwz.easyschool.BalanceQueryActivity;
import com.gxuwz.easyschool.CardLossActivity;
import com.gxuwz.easyschool.CardTopUpActivity;
import com.gxuwz.easyschool.CardUnlockActivity;
import com.gxuwz.easyschool.PaymentCodeActivity;
import com.gxuwz.easyschool.R;
import com.gxuwz.easyschool.TradeQueryActivity;
import com.gxuwz.easyschool.UpdatePasswordActivity;

public class SchoolCardFragment extends Fragment {
    private ImageView school_qrcode_item,news_update_item,school_card_topup_item,
            school_trade_query_item,school_card_loss_item,school_card_unlock_item,school_card_balance;

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.school_card_fragement, container, false);
        school_qrcode_item = view.findViewById(R.id.school_qrcode_item);
        school_qrcode_item.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(view.getContext(), PaymentCodeActivity.class);
                startActivity(intent);
            }
        });
        news_update_item = view.findViewById(R.id.news_update_item);
        news_update_item.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(view.getContext(), UpdatePasswordActivity.class);
                startActivity(intent);
            }
        });
        school_card_topup_item = view.findViewById(R.id.school_card_topup_item);
        school_card_topup_item.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(view.getContext(), CardTopUpActivity.class);
                startActivity(intent);
            }
        });
        school_trade_query_item = view.findViewById(R.id.school_trade_query_item);
        school_trade_query_item.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(view.getContext(), TradeQueryActivity.class);
                startActivity(intent);
            }
        });
        school_card_loss_item = view.findViewById(R.id.school_card_loss_item);
        school_card_loss_item.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(view.getContext(), CardLossActivity.class);
                startActivity(intent);
            }
        });
        school_card_unlock_item = view.findViewById(R.id.school_card_unlock_item);
        school_card_unlock_item.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(view.getContext(), CardUnlockActivity.class);
                startActivity(intent);
            }
        });
        school_card_balance = view.findViewById(R.id.school_card_balance);
        school_card_balance.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(view.getContext(), BalanceQueryActivity.class);
                startActivity(intent);
            }
        });

        return view;
    }

    public SchoolCardFragment getInstance() {
        SchoolCardFragment schoolCardFragment = new SchoolCardFragment();
        return schoolCardFragment;
    }
}
